﻿
using LogForParameter.IServices;
using LogForParameter.Model;
using LogForParameter.Services.BASE;
using LogForParameter.IRepository.Base;
using LogForParameter.IServices.ActivityService;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using Library.Helper;

namespace LogForParameter.Services
{
    public class ActivityServices : BaseServices<Activity>, IActivityServices
    {
        private readonly IBaseRepository<Activity> _dal;
        private readonly ILogger<ActivityServices> _logger;
        private readonly SzlhllNewNotice _szlhllNewNotice;

        public ActivityServices(IBaseRepository<Activity> dal, ILogger<ActivityServices> logger, SzlhllNewNotice szlhllNewNotice)
        {
            this._dal = dal;
            _logger = logger;
            _szlhllNewNotice = szlhllNewNotice;
            base.BaseDal = dal;
        }
        public async Task<string> AddASM()
        {
            await Task.Run(() => { _logger.LogInformation($"执行时间是{DateTime.UtcNow}"); });
            return "完成";
        }
        public async Task<string> ActivityNotice()
        {
            _logger.LogWarning("活动开始通知");
            _logger.LogWarning("活动通知结束");
            return await Task.FromResult("ok");
        }
        public string NoticeTest(string phoneNumber,string content)
        {
            _szlhllNewNotice.Send(phoneNumber, content, out string message);
            return message;
        }
    }
    public class SimpleAt
    {
        public int Id { get; set; }
        public string ActivityName { get; set; }
        /// <summary>
        /// 开始时间
        /// </summary>
        public DateTime? StartTime { get; set; }
    }
}